package com.cungmua.app.fragment;

import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;

import com.cungmua.app.R;
import com.koushikdutta.urlimageviewhelper.UrlImageViewHelper;

/**
 * Created by kelvin.nguyen on 6/25/14.
 */
public final class PlaceSlideFragment extends Fragment {
    public static final String IMAGE_URL = "image_url";
    private String imageUrl;

    public PlaceSlideFragment() {}

    public static PlaceSlideFragment newInstance(String imageUrl) {
        PlaceSlideFragment fragment = new PlaceSlideFragment();
        Bundle args = new Bundle();
        args.putString(IMAGE_URL, imageUrl);

        fragment.setArguments(args);

        return fragment;
    }

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        this.imageUrl = getArguments().getString(IMAGE_URL);
    }

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {
        View view = inflater.inflate(R.layout.fragment_image_pager_item, container, false);
        ImageView imageView = (ImageView) view.findViewById(R.id.imgPager);
        Log.d("image==================:", imageUrl);

        UrlImageViewHelper.setUrlDrawable(imageView, imageUrl);

        return view;
    }
}

